<?php

namespace api\controller;

// +----------------------------------------------------------------------
// | 租户职位数据控制层
// +----------------------------------------------------------------------

use common\controller\VerifyController;
use common\service\TenantPositionService;
use think\Request;

class TenantPositionController extends VerifyController
{
    /** @var TenantPositionService */
    private $tenantPositionService;

    public function __construct()
    {
        parent::__construct();
        $this->tenantPositionService = new TenantPositionService();
    }

    /**
     * 查询
     * @param Request $request
     * @return \think\Response
     * @throws \Exception
     */
    public function select(Request $request)
    {
        $param = $request->param()['param'];
        if (!isset($param['filter']['tenant_id'])) {
            $param['filter']['tenant_id'] = $request->getTenantId();
        }
        $param['page'] = $param['page'] ?? [1, C("database.database_max_select_rows")];
        $param['order'] = $param['order'] ?? 'id DESC';
        $res = $this->tenantPositionService->select($param);
        return json(success_response('OK', $res));
    }

}
